//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class LightRig : IOfficeXmlSerializable
    {
        private SphereCoordinates coordinates;
        private LightRightDirection direction;


        private LightRigType type;

        public SphereCoordinates Coordinates
        {
            get { return coordinates; }
            set { coordinates = value; }
        }

        public LightRigType Type
        {
            get { return type; }
            set { type = value; }
        }

        public LightRightDirection Direction
        {
            get { return direction; }
            set { direction = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("lightRig"))
            {
                Type = c.GetEnum<LightRigType>("rig");
                Direction = c.GetEnum<LightRightDirection>("dir");
                Coordinates = c.ReadOptionalElement<SphereCoordinates>("rot");
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("lightRig"))
            {
                c.SetEnum("rig", Type);
                c.SetEnum("dir", Direction);
                c.WriteOptionalElement(Coordinates);
            }
        }

        #endregion
    }
}